package traverser;

public class Bidirectional {	
	LinkProcessor p;	
	String[] listA;
	String[] listB;
	
	public boolean ifBidirectional(String linkA,String linkB){
		boolean b=false;
		p=new LinkProcessor(linkA);
		listA=p.getList();
		p=new LinkProcessor(linkB);
		listB=p.getList();
		if(checkAHasB(linkA,listB)&&checkAHasB(linkB,listA)) b=true;
		return b;
	}
	public boolean checkAHasB(String link,String[] s){
		boolean b=false;
		for(int i=0;i<s.length;i++){
			if(s[i].equals(link)) b=true;
		}
		
		return b;
	}
	
  public static void main(String[] args){
	  Bidirectional bi=new Bidirectional();
	  String a="http://en.wikipedia.org/wiki/Yang_Chen_Ning";
  	String b="http://en.wikipedia.org/wiki/Tsung-Dao_Lee";
	 System.out.print(bi.ifBidirectional(a, b));
  }
}
